package br.gendi.beans;

import java.net.URL;

import HTTPClient.HTTPConnection;
import HTTPClient.HTTPResponse;
import HTTPClient.NVPair;

public class GerenciandorConexoes {
	
	public static HTTPConnection Conectar(BaseGenomica b) {
		return null;
	}
	
	public static String RealizarBusca(BaseGenomica b, String epitopo) throws Exception {
		HTTPResponse rsp = null;
		HTTPConnection con = null;

		con = new HTTPConnection(new URL(b.getUrl()));
		
		NVPair[] post = b.gerarQuery();

		System.out.println(b.getMetodos());
		System.out.println(b.getFormAction());
		
		if (b.getMetodos().equals("get")) {
			rsp = con.Get(b.getFormAction(), post);
		} else {
			rsp = con.Post(b.getFormAction(), post);
		}
		String retorno = rsp.getText();
		return retorno;
	}
	
	public static String deCodificacaoHTML(String input) {
		return null;
	}
}
